define(function(require){
	var $ = require("jquery");
	var justep = require("$UI/system/lib/justep");
	var WindowDialog = require("$UI/system/components/justep/windowDialog/windowDialog");
	
	var Model = function(){
		this.dialogs = {};
		this.callParent();
	};

	Model.prototype.btnGetDataClick = function(event){
		var col = event.source.$domNode.attr('col');
		var master = event.source.$domNode.attr('master');
		var url = require.toUrl("../"+master+"/getData.w");
		var data = this.comp('demoData');
		var dlg = this.dialogs[col];
		if (!dlg){
			dlg = new WindowDialog({
					title : '选择',
					showTitle : true,
					status: "normal",
					src : url,
					parentNode : this.getRootNode()
			});
			dlg.on('onReceive', function(evt) {
				data.setValue(col, evt.data.val('fid'));
			}, this);
			this.dialogs[col] = dlg;			
		}
		dlg.open({str:url});
	};

	Model.prototype.textareaInit = function(event){
		event.option.toolbar=[
            'source | undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
            'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize' ,
            '| justifyleft justifycenter justifyright justifyjustify |',
            'link unlink | emotion image ',
            '| horizontal print preview fullscreen', 'drafts', 'formula'
        ];
	};
	
	return Model;
});